with Ada.Assertions; use Ada.Assertions;

separate(Test_Websites)

--
-- Test encapsulation methods get, set for website contents
--
--    test assertions
--
--    uses very large instance defined at package level
--

procedure Test_Contents_Encapsulation

is
begin

   --
   -- setup
   --

   Assert ( Website_Instance.Size = 0, "Contents Bound String is not empty at"
            & " start of test" );


   --
   -- append
   --

   Website_Instance.Set_Contents( "Jane" );

   Website_Instance.Set_Contents( " ", Append => true );

   Website_Instance.Set_Contents( "Doe", true );

   Assert( Website_Instance.Size = 8, "String size "
           & "unexpected in append test" );

   Assert( Website_Instance.Get_Contents = "Jane Doe", "String contents "
           & "unexpected in append test" );


   --
   -- overwrite
   --

   Website_Instance.Set_Contents("Anonymous");

   Website_Instance.Set_Contents( " ", Append => true );

   Website_Instance.Set_Contents( "Person", Append => true );

   Assert ( Website_Instance.Size = 16, "String size "
            & "unexpected in overwrite test" );


   --
   -- erase
   --

   Website_Instance.Erase;

   Assert ( Website_Instance.Size = 0, "String size not zero after erase" );


   --
   -- replace String contents: provide Bound String allocation for destructor
   --

   Website_Instance.Set_Contents( Website_Contents => "Anonymous Person",
                                  Append=> true );

   Assert ( Website_Instance.Size = 16, "String size unexpected in append test"
              & " following erase test" );


end Test_Contents_Encapsulation;
